]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Ensure the Cancel button passes undefined to close()
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Fri, 12 Mar 2021 06:13:18 +0000 (14:13 +0800)
committerDaniel van Vugt <daniel.van.vugt@canonical.com>
Mon, 15 Mar 2021 10:19:04 +0000 (18:19 +0800)
The parameter to `ModalDialog.close(timestamp)` is optional. But when
invoked via the network dialog's Cancel button it was receiving an
implicit parameter value that's definitely not a timestamp:

```
[0x560f18af0c50 StButton.modal-dialog-linked-button:first-child hover ("Cancel")]
```

And as of today (or gjs >= 1.67.3) that's reported as an error:
```
JS ERROR: Error: Argument timestamp: value is out of range for uint32
popModal@resource:///org/gnome/shell/ui/main.js:638:12
popModal@resource:///org/gnome/shell/ui/modalDialog.js:206:14
close@resource:///org/gnome/shell/ui/modalDialog.js:179:14
```
and so you can't Cancel the dialog anymore.

Make sure `ModalDialog.close()` receives an `undefined` timestamp it
knows how to handle.

Fixes: https://bugs.launchpad.net/bugs/1918666
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1757>

js/ui/status/network.js

index bb119f690c1fc82edd80f08e1c27b4b5fabbfe84..50423048c588a90f9843cec2c3c1a5faab9c0664 100644 (file)
@@ -937,7 +937,7 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
 
         this.contentLayout.add_child(this._stack);
 
-        this._disconnectButton = this.addButton({ action: this.close.bind(this),
+        this._disconnectButton = this.addButton({ action: () => this.close(),
                                                   label: _("Cancel"),
                                                   key: Clutter.KEY_Escape });
         this._connectButton = this.addButton({ action: this._connect.bind(this),